"use client"
/**
 * 装配抽奖
 * @param strategyId
 */
import {strategyArmory} from "@/apis";
export const StrategyArmory = () => {
    async function strategyArmoryHandle() {
        const queryParams = new URLSearchParams(window.location.search);
        const strategyId = Number(queryParams.get('strategyId'));
        if(!strategyId){
            window.alert("策略ID不能为空")
            return;
        }
        const response = await strategyArmory(strategyId);
        const {code, info} = await response.json();
        if(code != "0000"){
            window.alert("策略装配失败 code:" + code + " info:" + info)
            return;
        }

    }

    return (
        <div  className="px-6 py-2 mb-8 text-white bg-blue-500 rounded-full shadow-lg hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-300"
              style={{cursor: "pointer"}}
              onClick={strategyArmoryHandle}>
            装配抽奖
        </div>
    );
}